<?php

namespace App\Admin\Extensions;

use Encore\Admin\Actions\RowAction;
use Encore\Admin\Admin;
use Encore\Admin\Grid\Displayers\Modal;
class CheckDrawMoney extends RowAction
{

    protected $title = '贡献人详情';

    public function render()
    {
        // 模态框 ID
        $modalId = "contributions-modal-{$this->getKey()}";

        // 创建模态框
        $modal = Modal::make()
            ->lg()
            ->id($modalId)
            ->title('代理人贡献详情')
            ->body(CheckDrawMoney::make(['agentId'=>$this->row->agent_id, 'date'=>$this->row->date]))
            ->button("<a class='btn btn-sm btn-primary'>$this->title</a>");

        // 将模态框添加到行操作中
        return $modal->render();
    }
}
